{include file="common/mini_header" /}
<div class="login-content-l"></div>
<div class="login-content">
	<div class="login-content-mid">
		<div class="layui-container">
			<div>
				<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
				    <h3 class="login-header">登录</h3>
                    <div class="layui-tab-item layui-show">
                        <div class="layui-tab-content layui-form-pane">
                            <form class="layui-form" action="" method="post">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">账号：</label>
                                    <div class="layui-input-inline">
                                        <input type="text" name="mobile" lay-verify="required" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">密码：</label>
                                    <div class="layui-input-inline">
                                        <input type="password" name="password" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                                <div class="layui-form-item" style="display:none;" id="captcha_div">
                                    <label class="layui-form-label">验证码：</label>
                                    <div class="layui-input-inline" style="width:60px;">
                                        <input type="text" name="captcha" autocomplete="off" id="captcha_ipt" class="layui-input">
                                    </div>
                                    <div class="layui-input-inline" style="width:150px;">
                                        <img src="{:captcha_src()}" id="captcha_img" onclick="setCaptcha()" title="点击更换验证码" alt="captcha" style="max-width:150px;cursor:pointer;" />
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <div class="layui-input-inline">
                                        <input class="layui-btn layui-btn-fluid" lay-submit lay-filter="password_login" type="submit" value="登录" />
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
				</div>
			</div>
		</div>
	</div>
</div>
<div class="login-content-r"></div>
		<script>
			layui.use(['element', 'form'], function() {
				//密码登陆
				layui.form.on('submit(password_login)', function(data) {
					$.ajax({
						type: "POST",
						url: "{:url('manage/common/login')}",
						data: data.field,
						success: function(data) {
                            if(data.status) {
                                layer.msg('登陆成功，跳转中...');
                                setTimeout("window.location.href='" + data.data + "'; ", 1500);
                            } else {
                                if(data.data == '10013' || data.data == '10012'){
                                    $('#captcha_div').show();
                                }
                                setCaptcha();
                                layer.msg(data.msg);
                            }
						}
					});
					return false;
				});
			});
            //更改验证码图片
            function setCaptcha() {
                $('#captcha_ipt').val("");
                var timestamp=new Date().getTime();
                $('#captcha_img').attr('src','{:captcha_src()}?'+timestamp);
            }
		</script>
		{include file="common/mini_footer" /}